Importing Data

LEAP variables

school_leap <- full %>% select(c(2,3,5,6,7, 9:16, 109:129, 131:132, 151:156, 165:167, 281:286))
leaps_rank_cols <- c("leaps_rank_affirmation", "leaps_rank_anytime_anywhere", "leaps_rank_connection", "leaps_rank_customization", "leaps_rank_high_expectations", "leaps_rank_relevance", "leaps_rank_rigorous_learning", "leaps_rank_self_direction", "leaps_rank_social_consciousness", "leaps_rank_whole_child")

leaps_cols <- c("leaps_affirmation", "leaps_anytime_anywhere", "leaps_connection", "leaps_customization", "leaps_high_expectations", "leaps_relevance", "leaps_rigorous_learning", "leaps_self_direction", "leaps_social_consciousness", "leaps_whole_child")

# Realized this was not necessary
for (col_name in leaps_rank_cols) {
  school_leap[, col_name][school_leap[, col_name] == 0] <- NA
}

Distribution of LEAP Implementation

Counts

library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
p.1 <- school_leap %>%
  ggplot(aes(x = factor(leaps_affirmation, labels = 0:1)))+
  geom_bar(fill = "#1A4C81")+
    labs(x="Leaps Affirmation", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.2 <- school_leap %>%
  ggplot(aes(x = factor(leaps_anytime_anywhere, labels = 0:1)))+
  geom_bar(fill = "#59C3B4")+
    labs(x="Leaps Anytime Anywhere", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.3 <- school_leap %>%
  ggplot(aes(x = factor(leaps_connection, labels = 0:1)))+
  geom_bar(fill = "#EF464B")+
    labs(x="Leaps Connection", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.4 <- school_leap %>%
  ggplot(aes(x = factor(leaps_customization, labels = 0:1)))+
  geom_bar(fill = "#ADE0EE")+
    labs(x="Leaps Customization", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.5 <- school_leap %>%
  ggplot(aes(x = factor(leaps_high_expectations, labels = 0:1)))+
  geom_bar(fill = "#BC2582") +
    labs(x="Leaps High Expectations", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.6 <- school_leap %>%
  ggplot(aes(x = factor(leaps_relevance, labels = 0:1)))+
  geom_bar(fill = "#FFA630") +
    labs(x="Leaps Relevance", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.7 <- school_leap %>%
  ggplot(aes(x = factor(leaps_rigorous_learning, labels = 0:1)))+
  geom_bar(fill = "#99C24D") +
    labs(x="Leaps Rigorous Learning", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.8 <- school_leap %>%
  ggplot(aes(x = factor(leaps_self_direction, labels = 0:1)))+
  geom_bar(fill = "#FFDE42") +
    labs(x="Leaps Self Direction", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))

p.9 <- school_leap %>%
  ggplot(aes(x = factor(leaps_social_consciousness, labels = 0:1)))+
  geom_bar(fill = "#218380") +
    labs(x="Leaps Social Consciousness", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))


p.10 <- school_leap %>%
  ggplot(aes(x = factor(leaps_whole_child, labels = 0:1))) +
  geom_bar(fill = "#D3B7D7") +
  labs(x="Leaps Whole Child", y = "Count")+
  geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 8
  ) +
  scale_x_discrete(labels = c("0", "1"))




ggarrange(p.1, p.2, p.3, p.4, p.5, p.6, p.7, p.8, p.9, p.10, nrow = 3, ncol = 4)

Percentages

High expectations and whole child were the most likely to be reported as being implemented.

library(gridExtra)


leaps_percentage <- data.frame(
  name = character(),
  percent_yes = numeric(),
#  percent_no = numeric(),
  stringsAsFactors = FALSE
)

for (i in leaps_cols){
percent_yes <- round(sum(school_leap[[i]])/length(school_leap[[i]]) *100,2)

# percent_no <- round((length(school_leap[[i]]) - sum(school_leap[[i]]))/length(school_leap[[i]])*100, 2)

leaps_percentage <- rbind(leaps_percentage, data.frame(name = i, percent_yes = percent_yes))

}


leaps_percentage_long <- leaps_percentage %>%
  pivot_longer(cols = c("percent_yes"), names_to = "Status", values_to = "Percentage")

# Create a grouped bar plot
ggplot(leaps_percentage_long, aes(x = reorder(name, Percentage), y = Percentage, fill = Status)) +
  geom_bar(stat = "identity", position = "dodge", show.legend = FALSE) +
  geom_text(aes(label = Percentage), color = "black", size = 4, hjust = -.25) +
  theme_minimal() +
  labs(title = "Leaps Implementation", x = "Practice", y = "Percentage") +
  scale_fill_manual(values = c("percent_yes" = "#1A4C81")) +
  coord_flip()

Distribution of LEAP Rankings

library(gridExtra)

p1 <- school_leap %>%
  filter(!is.na(leaps_rank_affirmation)) %>%
  ggplot(aes(x = factor(leaps_rank_affirmation, labels = 1:10)))+
  geom_bar(fill = "#1A4C81")+
  labs(x="Leaps Rank Affirmation", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)


p2 <- school_leap %>%
  filter(!is.na(leaps_rank_anytime_anywhere)) %>%
  ggplot(aes(x = factor(leaps_rank_anytime_anywhere, labels = 1:10)))+
  geom_bar(fill = "#59C3B4")+
    labs(x="Leaps Rank Anytime Anywhere", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)


p3 <- school_leap %>%
  filter(!is.na(leaps_rank_connection)) %>%
  ggplot(aes(x = factor(leaps_rank_connection,labels = 1:10)))+
  geom_bar(fill = "#EF464B")+
      labs(x="Leaps Rank Connection", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p4 <- school_leap %>%
  filter(!is.na(leaps_rank_customization)) %>%
  ggplot(aes(x = factor(leaps_rank_customization, label =1:10)))+
  geom_bar(fill = "#ADE0EE")+
      labs(x="Leaps Rank Customization", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p5 <- school_leap %>%
  filter(!is.na(leaps_rank_high_expectations)) %>%
  ggplot(aes(x = factor(leaps_rank_high_expectations, labels = 1:10)))+
  geom_bar(fill = "#BC2582")+
      labs(x="Leaps Rank High Expectations", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p6 <- school_leap %>%
  filter(!is.na(leaps_rank_relevance)) %>%
  ggplot(aes(x = factor(leaps_rank_relevance, labels=1:10)))+
  geom_bar(fill = "#FFA630")+
      labs(x="Leaps Rank Relevance", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p7 <- school_leap %>%
  filter(!is.na(leaps_rank_rigorous_learning))%>%
  ggplot(aes(x = factor(leaps_rank_rigorous_learning, labels = 1:10)))+
  geom_bar(fill = "#99C24D")+
      labs(x="Leaps Rank Rigorous Learning", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p8 <- school_leap %>%
  filter(!is.na(leaps_rank_self_direction)) %>%
  ggplot(aes(x = factor(leaps_rank_self_direction, labels = 1:10)))+
  geom_bar(fill = "#FFDE42")+
      labs(x="Leaps Rank Self Direction", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p9 <- school_leap %>%
  filter(!is.na(leaps_rank_social_consciousness))%>%
  ggplot(aes(x = factor(leaps_rank_social_consciousness, labels = 1:10)))+
  geom_bar(fill = "#218380")+
      labs(x="Leaps Rank Social consciousness", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

p10 <- school_leap %>%
  filter(!is.na(leaps_rank_whole_child))%>%
  ggplot(aes(x = factor(leaps_rank_whole_child, labels = 1:10)))+
  geom_bar(fill = "#D3B7D7")+
      labs(x="Leaps Rank Whole Child", y = "Count")+
    geom_text(
    stat = "count",
    aes(label = after_stat(count)),
    vjust = 0.75,
    color = "black",
    size = 5
  ) +
  scale_x_discrete(labels = 1:10)

ggarrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, ncol = 3, nrow = 4)

Ranked Leap Tags

I am not sure how to get the branding to work with ggplot. I have tried but I can’t figure out how to get the branding to work right. I have downloaded the fonts too but it doesn’t seem to show the correct font.

Anyway, Whole child was ranked 1 by the most schools. Whereas Rigorous learning was ranked 10 or the least important shift in student experience.

column_sums <- colSums(school_leap[, leaps_rank_cols], na.rm = TRUE)

# Rank the columns based on the lowest sum (ascending order)
ranked_columns <- order(column_sums)

# Create a data frame to store the ranked column information
ranked_data <- data.frame(
  Rank = 1:length(ranked_columns),
  Column = leaps_rank_cols[ranked_columns],
  Sum = column_sums[ranked_columns]
)



# Print the ranked column names and their corresponding sums
for (i in 1:length(ranked_columns)) {
  col_index <- ranked_columns[i]
  col_name <- leaps_rank_cols[col_index]
  col_sum <- column_sums[col_index]
  cat("Rank", i, ":", col_name, "- Sum:", col_sum, "\n")
}
## Rank 1 : leaps_rank_whole_child - Sum: 524 
## Rank 2 : leaps_rank_anytime_anywhere - Sum: 606 
## Rank 3 : leaps_rank_high_expectations - Sum: 650 
## Rank 4 : leaps_rank_self_direction - Sum: 660 
## Rank 5 : leaps_rank_connection - Sum: 676 
## Rank 6 : leaps_rank_relevance - Sum: 681 
## Rank 7 : leaps_rank_affirmation - Sum: 691 
## Rank 8 : leaps_rank_social_consciousness - Sum: 693 
## Rank 9 : leaps_rank_customization - Sum: 701 
## Rank 10 : leaps_rank_rigorous_learning - Sum: 763
bar_colors <- c("#1A4C81", "#59C3B4", "#EF464B", "#ADE0EE", "#BC2582", "#FFA630", "#99C24D", "#FFDE42", "#218380", "#D3B7D7")  # Color palette for the bars

ggplot(ranked_data, aes(x = reorder(Column,Rank), y = Rank, fill = Column)) +
  geom_col() +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, vjust = 0.05, hjust = 0.15, size = 8),
        legend.position = "none") +
  labs(title = "Ranked LEAPs Columns", x = NULL, y = "Rank") +
  scale_fill_manual(values = bar_colors) +
  scale_y_discrete(breaks = c(1, 10))

Leap Tags Implemenetation

For this I just did a count because it was 1 or 0 where 1 was implementation of a practice so practices with higher scores meant that they were reported to be implemented more often.

Leaps_sums <- colSums(school_leap[, leaps_cols], na.rm = TRUE)

# Rank the columns based on the lowest sum (ascending order)
summed_columns <- order(Leaps_sums, decreasing = TRUE)

# Create a data frame to store the ranked column information
Leaps_data <- data.frame(
  Column = leaps_cols[summed_columns],
  Sum = Leaps_sums[summed_columns]
)



# Print the ranked column names and their corresponding sums
for (i in 1:length(summed_columns)) {
  col_index <- summed_columns[i]
  col_name <- leaps_cols[col_index]
  col_sum <- Leaps_sums[col_index]
  cat("Rank", i, ":", col_name, "- Sum:", col_sum, "\n")
}
## Rank 1 : leaps_high_expectations - Sum: 187 
## Rank 2 : leaps_connection - Sum: 180 
## Rank 3 : leaps_whole_child - Sum: 169 
## Rank 4 : leaps_rigorous_learning - Sum: 166 
## Rank 5 : leaps_customization - Sum: 157 
## Rank 6 : leaps_relevance - Sum: 157 
## Rank 7 : leaps_self_direction - Sum: 152 
## Rank 8 : leaps_affirmation - Sum: 145 
## Rank 9 : leaps_social_consciousness - Sum: 121 
## Rank 10 : leaps_anytime_anywhere - Sum: 108
ggplot(Leaps_data, aes(x = reorder(Column,Sum), y = Sum, fill = Column)) +
  geom_col() +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, vjust = 0.05, hjust = 0.15, size = 8),
        legend.position = "none") +
  labs(title = "LEAPs Implementation", x = NULL, y = "Sum") +
  scale_fill_manual(values = bar_colors) +
  scale_y_discrete(breaks = c(1, 10))

The Anytime Anywhere practice and Social Consciousness practice were the least commonly picked practices. They were the only ones that were implemented less than 50% of the time. High expectations and Connection were the practices that were most likely to be in implementation.

Implementation by locale

First I need to bring in the locale code to recode those variables

In Progress still

# Recoding the location variables for rural schools
school_leap <- school_leap %>%
  mutate(rural = recode(self_reported_locale_rural,
                                             "0" = "No",
                                             "1" = "Yes"))
# Recoding the location variables for suburban schools
school_leap <- school_leap %>%
  mutate(suburban = recode(self_reported_locale_suburban,
                                             "0" = "No",
                                             "1" = "Yes"))
# Recoding the location variables for urban schools
school_leap <- school_leap %>%
  mutate(urban = recode(self_reported_locale_urban,
                                             "0" = "No",
                                             "1" = "Yes"))

# Recoding the location variables into one location column
school_leap <- school_leap %>%
  mutate(location = case_when(
    rural == "Yes" & urban == "No" & suburban == "No" ~ "Rural",
    rural == "No" & urban == "Yes" & suburban == "No" ~ "Urban",
    rural == "No" & urban == "No" & suburban == "Yes" ~ "Suburban",
    TRUE ~ "Multiple"  # add an "Other" category for rows that don't fit any of the above conditions
  ))

Implementation by locale bump

Locale and implementation

#install.packages("ggbump")
library(ggbump)

## NEED TO GROUP BY EXCLUSIVE LOCALE
school_leap_bump <- school_leap %>%
  select(c(2,24:28,30:34,42, 45, 50))

# Reshape data from wide to long format
locale_leap_bump_long <- pivot_longer(school_leap_bump, cols = starts_with("leaps_"), names_to = "practice", values_to = "value")

avg_imp_data <- school_leap_bump %>%
  group_by(exclusive_locale) %>%
  summarize(across(starts_with("leaps_"), mean, na.rm = TRUE), .groups = "drop")

locale_avg_imp <- pivot_longer(avg_imp_data, cols = starts_with("leaps_"), names_to = "practice", values_to = "avg_imp")

##########################

locale_avg_imp %>% 
  group_by(exclusive_locale, practice) %>%
  ggplot(aes(x = exclusive_locale, y = avg_imp, color = practice, group = practice)) +
  geom_bump(size = 1.5, na.rm = TRUE, smooth = 8) + 
  geom_point(size = 6)

locale_avg_imp %>% 
  group_by(exclusive_locale, practice) %>%
  ggplot(aes(x = practice, y = avg_imp, color = exclusive_locale, group = exclusive_locale)) +
  geom_bump(size = 1.5, na.rm = TRUE, smooth = 8) + 
  geom_point(size = 6)+
  theme(axis.text.x = element_text(angle = 45, vjust = 0.15, hjust = 0.15, size = 8))

Counts of implementation by locale

We can see that there are more urban schools then others and they seem to set the trend for the counts and whether there is a big discrepancy in if the practice is implemented or not.

library(ggpubr)

p1 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_affirmation)%>%
  ggplot(aes(x = leaps_affirmation, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p2 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_anytime_anywhere)%>%
  ggplot(aes(x = leaps_anytime_anywhere, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))
  

p3 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_connection)%>%
  ggplot(aes(x = leaps_connection, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p4 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_customization)%>%
  ggplot(aes(x = leaps_customization, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p5 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_high_expectations)%>%
  ggplot(aes(x = leaps_high_expectations, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p6 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_relevance)%>%
  ggplot(aes(x = leaps_relevance, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p7 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_rigorous_learning)%>%
  ggplot(aes(x = leaps_rigorous_learning, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p8 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_self_direction)%>%
  ggplot(aes(x = leaps_self_direction, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p9 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_social_consciousness)%>%
  ggplot(aes(x = leaps_social_consciousness, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))

p10 <- school_leap %>%
  group_by(exclusive_locale)%>%
  count(leaps_whole_child)%>%
  ggplot(aes(x = leaps_whole_child, y = n, fill = exclusive_locale))+
  geom_col(position = "dodge")+
  scale_fill_manual(values = transcend_cols)+
  scale_x_continuous(breaks = c(0, 1))


ggarrange(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, ncol = 3, nrow = 4, common.legend = TRUE, legend = "right")

Here is a table showing the counts by locale and by variable

library(DT)

locale_leap_counts <- school_leap %>%
  select(c(1,2,24:28,30:34,42))


# Reshape data from wide to long format
locale_leap_long <- pivot_longer(locale_leap_counts, cols = starts_with("leaps_"), names_to = "practice", values_to = "value")

# Group by location and practice, and calculate counts
table_counts <- locale_leap_long %>% 
  group_by(exclusive_locale, practice) %>% 
  summarise(count = sum(value))
## `summarise()` has grouped output by 'exclusive_locale'. You can override using
## the `.groups` argument.
# View the resulting table
datatable(table_counts)

Ranking by locale

Locale and Ranking

#install.packages("ggbump")
library(ggbump)
library(dplyr)

## NEED TO GROUP BY EXCLUSIVE LOCALE
school_leap_bump <- school_leap %>%
  select(c(2,14:24, 42, 45, 50))

# Reshape data from wide to long format
locale_leap_bump_long <- pivot_longer(school_leap_bump, cols = starts_with("leaps_rank"), names_to = "practice", values_to = "value")

### I REALIZED I NEED TO CACULATE THE RANKS AGAIN
# THIS NEEDS TO BE EDITED


avg_rank_data <- school_leap_bump %>%
  group_by(exclusive_locale) %>%
  summarize(across(starts_with("leaps_rank"), mean, na.rm = TRUE), .groups = "drop")

locale_avg_rank <- pivot_longer(avg_rank_data, cols = starts_with("leaps_rank"), names_to = "practice", values_to = "avg_rank")

# Plot the grouped bar chart
ggplot(locale_avg_rank, aes(x = reorder(practice, avg_rank), y = avg_rank, fill = exclusive_locale)) +
  geom_col(position = "dodge") +
  labs(x = "Practice", y = "Average Rank", fill = "School Location") +
  theme_minimal()+
  scale_fill_manual(values = bar_colors) +
  scale_y_discrete(breaks = c(1, 10))+
  theme(axis.text.x = element_text(angle = 45, vjust = 0.15, hjust = 0.15, size = 8))

ggplot(locale_avg_rank, aes(x = exclusive_locale, y = avg_rank, fill = reorder(practice, avg_rank))) +
  geom_col(position = "dodge") +
  labs(x = "Practice", y = "Average Rank", fill = "School Location") +
  theme_minimal() +
  scale_fill_manual(values = bar_colors) +
  scale_y_discrete(breaks = c(1, 10))

###### Bump graphs that don't really work
locale_avg_rank %>% 
  group_by(exclusive_locale, practice) %>%
  ggplot(aes(x = exclusive_locale, y = avg_rank, color = practice, group = practice)) +
  geom_bump(size = 1.5, na.rm = TRUE, smooth = 8) + 
  geom_point(size = 6)

locale_avg_rank %>% 
  group_by(exclusive_locale, practice) %>%
  ggplot(aes(x = practice, y = avg_rank, color = exclusive_locale, group = exclusive_locale)) +
  geom_bump(size = 1.5, na.rm = TRUE, smooth = 8) + 
  geom_point(size = 6)+
  theme(axis.text.x = element_text(angle = 45, vjust = 0.15, hjust = 0.15, size = 8))

Ranking and Percent Implementation Graph

# Load the required packages
library(ggplot2)

# Create a data frame with the ranking and implementation data
rank_data <- data.frame(
  Practice = leaps_cols,
  Ranking = c(7, 2, 5, 9, 3, 6, 10, 4, 8, 1),
  Implementation = c(57.77, 43.03, 71.71, 62.55, 74.50, 62.55, 66.14, 60.56, 48.21, 67.33)
)




leaps_cols
##  [1] "leaps_affirmation"          "leaps_anytime_anywhere"    
##  [3] "leaps_connection"           "leaps_customization"       
##  [5] "leaps_high_expectations"    "leaps_relevance"           
##  [7] "leaps_rigorous_learning"    "leaps_self_direction"      
##  [9] "leaps_social_consciousness" "leaps_whole_child"
custom_labels <- c("Whole Child", "Anytime Anywhere", "High Expectations", "Self Direction", " Connection",
                   "Relevance", "Affirmation", "Social Consciousness", "Customization", "Rigorous Learning")
# Create the bar chart ordered by rank
ggplot(rank_data, aes(x = reorder(Practice, Ranking))) +
  geom_bar(aes(y = Implementation), stat = "identity", fill = "#1A4C81") +
  scale_y_continuous(
    name = "Percentage of Implementation",
    sec.axis = sec_axis(~./(max(rank_data$Ranking) / max(rank_data$Implementation)), 
                        name = "")
  ) +
  geom_text(aes(y = Ranking, label = Ranking), color = "#EF464B", size = 6, vjust = -0.25) +
  geom_text(aes(y = Implementation, label = Implementation), color = "black", size = 4, vjust = 2.25) +
  scale_x_discrete(labels = custom_labels) +
  labs(title = "Ranking and Percentage of Implementation", x = "") +
  theme_minimal()+
  ylim(0, 100)+
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.